<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        #box1,
        #box2 {
            width: 200px;
            height: 200px;
        }

        #box1 {
            width: 250px;
            margin-bottom: -40px;
            opacity: 0.3;
            background-color: aqua;
        }

        #box2 {
            margin-top: 10px;
            background-color: aquamarine;
        }
    </style>
</head>

<body>
    <!-- 

        相邻的margin-top和margin-bottom都是正值，取最大的
        相邻的margin-top和margin-bottom都是负值，取绝对值最大的
        相邻的margin-top和margin-bottom一正一负，相加求和

     -->
    <div id="box1"></div>
    <div id="box2"></div>
</body>

</html>